﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KxParser.Parser.LR
{
    public class GrammarEx
    {
        public string Name { get; set; }
		public string Rule { get; set; }
		//public List<string> RuleItems { get { return Rule.Split(Global.RuleItemSeparator).ToList(); } }

		/// <summary>
		/// Backus-Naur grammar constructor
		/// </summary>
		/// <param name="name">Grammar name</param>
		/// <param name="rule">Grammar rule</param>
		public GrammarEx(string name, string rule)
		{
			Name = name;
			Rule = rule;
		}

		public override string ToString()
		{
			return Name + " -> " + Rule;
		}

		public override bool Equals(object obj)
		{
            if (typeof(GrammarEx).IsAssignableFrom(obj.GetType()))
			{
                GrammarEx grammar2 = ((GrammarEx)obj);
				return Name.Equals(grammar2.Name) && Rule.Equals(grammar2.Rule);
			}
			return false;
		}
    }
}
